PHP can display the date and time of the server through the date () function, and here's a detailed look at how to use the date () function to output the date:
php Date () function detailed
1, year-month-day
The code is as follows
Why is the time obtained by date () in php5 not the solution of the current time. The related setting is to modify php. date. timezone parameter: [Date]; definesthedefadefatimezoneusedbythedatefunctions; date. timezone is disabled by default. you
The time and date of the php program call time do not match the time at that time. solution: the time and date of the php program call time do not match the time at that time. the system environment is win2003 + php5.2 + mysql5.0 today we found that
Php & gt; php time zone time error question date current time difference (reproduced) about php time zone time error question date current time difference local date_default_timezone_set there is a legacy problem before, that is, the time when
Php & gt; php time zone time error question date current time difference (reproduced) about php time zone time error question date current time difference local date_default_timezone_set there is a legacy problem before, is echodate ("y-m-dh: I: s",
Modify the date. timezone parameter in php. ini:[Date]; Defines the default timezone used by the date functions; Date. timezone =It is disabled by default. You only need to remove the comment and change it[Date]; Defines the default timezone used by
The related setting is to modify the Date.timezone parameter in php.ini:
[Date]
; Defines the default timezone used by the date functions
;d Ate.timezone =
The default is off, just remove the comment, you can
[Date]
; Defines the default timezone
First, ReasonStarting with php5.1.0,PHP. INI has date.timezone this option and is turned off by defaultThat is, the time displayed (whatever PHP command is used) is Greenwich Mean TimeAnd our Time (Beijing time) The difference is exactly 8 hours.Ii.
If you want to get the current time for PHP beginners, you can use the time function date () to format a local time/date and write a test code:
Echo date ('Y-m-d h: I: s ');? > 〉
Output Current Time: 02:32:17The actual time is 10:32:17
A, date () function
string Date (string $format [, int $timestamp])Function: Formats the timestamp as an easy-to-read time and date.
Parameters
Description
Format
Necessary. Specifies
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.